package com.symbio.ishenapi.background.controller;

import com.jfinal.plugin.activerecord.Record;
import com.symbio.ishenapi.background.model.TmBackgroundDictionary;
import com.symbio.ishenapi.common.controller.BaseController;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: chen
 * @Description:后台的字典表管理控制层
 * @Date: Created in 15:04 2018/11/13
 * @Modified By:
 */
@RequestMapping("/TmBackgroundDictionary")
public class TmBackgroundDictionaryController extends BaseController{

    /**
     * 获取医生的字典类型
     */
    public void findByType(){
        String type = getPara("type");
        try {
            List<Record> data = TmBackgroundDictionary.dao.findByType(type);
            renderJson(data);
        }catch (Exception e){
            renderJsonError(40005,"字典查询出错");
        }
    }

    public void findValues(){
        String type = getPara("type");
        try {
            List<String> data = TmBackgroundDictionary.dao.findValues(type);
            renderJson(data);
        }catch (Exception e){
            renderJsonError(40005,"字典查询出错");
        }
    }
}
